package July;

import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.util.Scanner;
import java.util.Set;

public class Test07JDK8ZoneId {
    public static void main(String[] args) {
        //获取所有时区的名称
        Set<String> zoneIds = ZoneId.getAvailableZoneIds();
        System.out.println(zoneIds);
        System.out.println(zoneIds.size());
        //获取当前系统的默认时区
        ZoneId zoneId = ZoneId.systemDefault();
        System.out.println(zoneId);
        //根据（秒/毫秒/纳秒）获取Instant对象
        Instant instant1 = Instant.ofEpochMilli(0L);
        System.out.println(instant1);
        Instant instant2 = Instant.ofEpochSecond(1L);
        System.out.println(instant2);
        Instant instant3 = Instant.ofEpochSecond(1L, 1000000000L);
        System.out.println(instant3);


        LocalDateTime today = LocalDateTime.now();
        System.out.println(today);
        LocalDateTime birthday = LocalDateTime.of(2001, 8, 28,0,0,0);
        System.out.println(birthday);

        System.out.println("相差的年数" + ChronoUnit.YEARS.between(birthday,today));
        System.out.println("相差的月数" + ChronoUnit.MONTHS.between(birthday,today));
        System.out.println("相差的周数" + ChronoUnit.WEEKS.between(birthday,today));
        System.out.println("==================");

        Scanner scanner=new Scanner(System.in);
//        String a1 = scanner.next();
//        String a2 = scanner.next();

        String a3 = scanner.nextLine();
        System.out.println(a3);


    }
}
